package cn.bugstack.gateway.socket;

import cn.bugstack.gateway.session.Configuration;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.sctp.nio.NioSctpServerChannel;
import lombok.Builder;

import java.nio.channels.Channel;
import java.util.concurrent.Callable;

public class GatewaySocketSever implements Callable<Channel> {
 private final EventLoopGroup parent=   new NioEventLoopGroup(1);
    private final EventLoopGroup child = new NioEventLoopGroup();
    private  final Configuration configuration;

    public GatewaySocketSever(Configuration configuration) {
        this.configuration=configuration;
    }

    @Override
    public Channel call() throws Exception {

try{
    ServerBootstrap b = new ServerBootstrap();
    b.group(parent, child)
            .channel(NioSctpServerChannel.class)
            .option(ChannelOption.SO_BACKLOG,128)
            .childHandler(new GatewayChannelInitializer());
}
        return null;
    }
}
